﻿using System;
using GianosNET.Common.Classes;

namespace ClientApp.Classes.RemotedService
    {        
        [System.ServiceModel.ServiceContractAttribute(ConfigurationName = "RemotedService.IRemotedServiceManager", CallbackContract = typeof(ClientApp.Classes.RemotedService.IRemotedServiceManagerCallback), SessionMode = System.ServiceModel.SessionMode.Required)]
        public interface IRemotedServiceManager
        {

            [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IRemotedServiceManager/Authenticate", ReplyAction = "http://tempuri.org/IRemotedServiceManager/AuthenticateResponse")]
            bool Authenticate(out string token, string userId, string password);

            [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IRemotedServiceManager/LogOff", ReplyAction = "http://tempuri.org/IRemotedServiceManager/LogOffResponse")]
            void LogOff();

            [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IRemotedServiceManager/RequestServerShutdown", ReplyAction = "http://tempuri.org/IRemotedServiceManager/RequestServerShutdownResponse")]
            void RequestServerShutdown();

            [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IRemotedServiceManager/StartService", ReplyAction = "http://tempuri.org/IRemotedServiceManager/StartServiceResponse")]
            void StartService(System.Guid svcId);

            [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IRemotedServiceManager/StopService", ReplyAction = "http://tempuri.org/IRemotedServiceManager/StopServiceResponse")]
            void StopService(System.Guid svcId);

            [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IRemotedServiceManager/StartLoopingSession", ReplyAction = "http://tempuri.org/IRemotedServiceManager/StartLoopingSessionResponse")]
            void StartLoopingSession(System.Guid svcId);

            [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IRemotedServiceManager/SetLoopingPause", ReplyAction = "http://tempuri.org/IRemotedServiceManager/SetLoopingPauseResponse")]
            void SetLoopingPause(System.Guid svcId, int secs);

            [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IRemotedServiceManager/GetServiceList", ReplyAction = "http://tempuri.org/IRemotedServiceManager/GetServiceListResponse")]
            ServiceInfo[] GetServiceList();
            [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IRemotedServiceManager/GetLog", ReplyAction = "http://tempuri.org/IRemotedServiceManager/GetLogResponse")]
            LogQueue GetLog(Guid g);

            [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IRemotedServiceManager/GetServerVersion", ReplyAction = "http://tempuri.org/IRemotedServiceManager/GetServerVersionResponse")]
            string GetServerVersion();
        }
            
        public interface IRemotedServiceManagerCallback
        {

            [System.ServiceModel.OperationContractAttribute(IsOneWay = true, Action = "http://tempuri.org/IRemotedServiceManager/LogUpdate")]
            void LogUpdate(System.Guid id, string msg);

            [System.ServiceModel.OperationContractAttribute(IsOneWay = true, Action = "http://tempuri.org/IRemotedServiceManager/ServiceStatusChanged")]
            void ServiceStatusChanged(System.Guid id, RemotedClass.RemotedClassStatusEnum status);

            [System.ServiceModel.OperationContractAttribute(IsOneWay = true, Action = "http://tempuri.org/IRemotedServiceManager/LoopingStatusChanged")]
            void LoopingStatusChanged(System.Guid id, LoopingService.LoopingStateEnum status);

            [System.ServiceModel.OperationContractAttribute(IsOneWay = true, Action = "http://tempuri.org/IRemotedServiceManager/LoopingIdleCountdown")]
            void LoopingIdleCountdown(System.Guid id, int secs);

            [System.ServiceModel.OperationContractAttribute(IsOneWay = true,
                Action = "http://tempuri.org/IRemotedServiceManager/ForceFullClientRefresh")]
            void ForceFullClientRefresh();
        }

        public interface IRemotedServiceManagerChannel : ClientApp.Classes.RemotedService.IRemotedServiceManager, System.ServiceModel.IClientChannel
        {
        }

        [System.Diagnostics.DebuggerStepThroughAttribute()]
        public partial class RemotedServiceManagerClient : 
            System.ServiceModel.DuplexClientBase<ClientApp.Classes.RemotedService.IRemotedServiceManager>, 
            ClientApp.Classes.RemotedService.IRemotedServiceManager
        {

            public RemotedServiceManagerClient(System.ServiceModel.InstanceContext callbackInstance) :
                base(callbackInstance)
            {
               
            }

            public RemotedServiceManagerClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName) :
                base(callbackInstance, endpointConfigurationName)
            {
            }

            public RemotedServiceManagerClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName, string remoteAddress) :
                base(callbackInstance, endpointConfigurationName, remoteAddress)
            {
            }

            public RemotedServiceManagerClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
                base(callbackInstance, endpointConfigurationName, remoteAddress)
            {
            }

            public RemotedServiceManagerClient(System.ServiceModel.InstanceContext callbackInstance, System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
                base(callbackInstance, binding, remoteAddress)
            {
            }

            public bool Authenticate(out string token, string userId, string password)
            {
                return base.Channel.Authenticate(out token, userId, password);
            }

            public void LogOff()
            {
                base.Channel.LogOff();
            }
            
            public void RequestServerShutdown()
            {
                base.Channel.RequestServerShutdown();
            }

            public void StartService(System.Guid svcId)
            {
                base.Channel.StartService(svcId);
            }

            public void StopService(System.Guid svcId)
            {
                base.Channel.StopService(svcId);
            }

            public void StartLoopingSession(System.Guid svcId)
            {
                base.Channel.StartLoopingSession(svcId);
            }

            public void SetLoopingPause(System.Guid svcId, int secs)
            {
                base.Channel.SetLoopingPause(svcId, secs);
            }

            public ServiceInfo[] GetServiceList()
            {
                return base.Channel.GetServiceList();
            }

            public LogQueue GetLog(Guid g)
            {
                return base.Channel.GetLog(g);
            }

            public string GetServerVersion()
            {
                return base.Channel.GetServerVersion();
            }
        }
    }

